home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
271_02
/
keyboard.doc
< prev
next >
Wrap
Text File
|
1987-08-18
|
2KB
|
55 lines
NAME
keyboard functions
SYNOPSIS
r = _kbstate();
r = kbstatus(i);
setcaps();
clrcaps();
setnumlock();
clrnumlock();
int r; response
int i; which key status to return
DESCRIPTION
These functions all manipulate the keyboard status flags
at 0000:417 and 0000:418. _kbstate() returns the flags
in a strict binary format as they appear in memory, with
:417 in the low byte and :418 in the high byte.
kbstatus(i) takes a value (from the list below) and returns
a TRUE or FALSE condition for the selected key state.
setcaps() will force the caps lock flag ON, and clrcaps
will force it off. Similarly, setnumlock() and clrnumlock()
will work on the num lock flag.
For kbstatus the arguments are:
0 = return status of shift key(s)
1 = return insert state
2 = return caps lock state
3 = return num lock state
4 = return scroll lock state
5 = return <alt> state
6 = return <ctrl> state
EXAMPLE
setcaps();
if(kbstate(2)) puts("Caps lock is now set");
else puts("Caps lock is NOT set");
clrcaps();
puts("Caps lock should now be off");
This function is found in SMTCx.LIB for the Turbo-C Compiler.